import Fields from 'dependencies/Fields'
import Field from 'dependencies/Field'

export const id = new Field({
  prop: '_id',
  label: '提现ID'
})

export const user_id = new Field({
  prop: 'user_id',
  label: '下单用户ID'
})

export const amount = new Field({
  prop: 'amount',
  label: '提现金额'
})

export const charge = new Field({
  prop: 'charge',
  label: '手续费'
})

export const received = new Field({
  prop: 'received',
  label: '实际到账'
})

export const status = new Field({
  prop: 'status',
  label: '提现状态',
  type: 'select',
  enums: [{
      value: 1,
      label: "待打款"
    },
    {
      value: 2,
      label: "打款成功"
    }
  ]
})

export const created_at = new Field({
  prop: 'created_at',
  label: '提现时间'
})

export const updated_id = new Field({
  prop: 'updated_id',
  label: '打款人'
})

export const updated_at = new Field({
  prop: 'updated_at',
  label: '打款时间'
})

export const cashOutListFields = Object.freeze([
  id,
  amount.setListComponent({
    props: {
      value: Number
    },
    render(h) {
      return h('span', '￥' + vk.pubfn.priceFilter(this.value) || '--')
    }
  }),
  charge.setListComponent({
    props: {
      value: Number
    },
    render(h) {
      return h('span', '￥' + vk.pubfn.priceFilter(this.value) || '--')
    }
  }),
  received.setListComponent({
    props: {
      value: Number
    },
    render(h) {
      return h('span', '￥' + vk.pubfn.priceFilter(this.value) || '--')
    }
  }),
  user_id,
  status,
  created_at,
  updated_id,
  updated_at
])

export const queryListFields = Object.freeze([
  id,
  status,
  user_id
])

export const columns = [{
    key: "_id",
    title: "id",
    type: "text"
  },
  {
    key: "status",
    title: "状态",
    type: "int"
  },
  {
    key: "user_id",
    title: "user_id",
    type: "int"
  }
]